package cn.com.code.design;

/**
 * 双重校验 线程安全 懒汉式
 *
 * @author zhengpei
 * @date 2021/9/17
 */
public class Singleton05 {

  private static volatile Singleton05 instance;

  private Singleton05() {

  }

  public static Singleton05 getInstance() {
    if (null != instance) {
      return instance;
    }
    synchronized (Singleton05.class) {
      if (null == instance) {
        instance = new Singleton05();
      }
    }
    return instance;
  }

}
